package router

import (
	"AiBus/controller"
	_ "AiBus/docs"
	"AiBus/middleware"
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
)

func Start(r *gin.Engine) {
	r.Use(middleware.Cors())
	//r.Static("/image","")
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

	g := r.Group("/api")
	g.POST("wx_login", controller.WX_Login)
	g.POST("app_code_login", controller.AppCodeLogin)
	g.GET("check_token", controller.CheckToken)
	g.GET("sm_cod", controller.GainSMCode)
	g.GET("/api_test", controller.APITest)
	g.Use(middleware.ChecKToken())
	//g.Use(middleware.Cors())
	{
		g.POST("credit_grants", controller.CreditGrants)
		g.POST("completions", controller.Completions)
		g.GET("userinfo", controller.GetUserInfo)
		g.GET("version", controller.VersionsHistory)
		g.GET("search", controller.GetSearch)
		g.GET("todo_class", controller.ToDoClass)
		g.POST("add_todo", controller.ADDTODO)
		g.GET("get_todo", controller.GetToDo)
		g.GET("get_over_todo", controller.GetOverToDo)
		g.GET("get_del_todo", controller.GetAllDelToDo)
		g.PUT("finish", controller.FinishToDo)
		g.DELETE("delete", controller.DelToDo)
		g.PUT("todo_update", controller.ToDoUPDATE)
		g.GET("todo_concreteness", controller.ConcretenessTODO)

		//g.PUT("todo_state", controller.ToDoState)
		/*导出功能*/
	}

	s := g.Group("system")
	{
		s.POST("system_parameter_email", controller.AddMail)
		s.GET("get_all_system", controller.GetAllSystem)
	}

	//r.GET("/credit_grants", credit_grants)
}
